import LoginIndex from './loginIndex'
import signIn from './signIn'
import LoginRegister from './signUp'

const loginRouter = {

  path: '/',
  getChildRoutes(location, cb) {
    require.ensure([], function (require) {
      cb(null, [
        {
          path: 'login',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./signIn'))
            })
          }
        },
        {
          path: 'register',
          getComponents(nextState, cb) {
            require.ensure([], function (require) {
              cb(null, require('./signUp'))
            })
          }
        },
      ])
    })
  },
  indexRoute: {
    getComponents(nextState, cb) {
      require.ensure([], function (require) {
        cb(null, signIn)
      })
      return cb()
    }
  },

  getComponents(nextState, cb) {
    require.ensure([], function (require) {
      cb(null, LoginIndex)
    })
  }

}

export default loginRouter;

